package rsj.api.test.offline;

import com.rlyy.aibase.utils.base.Box;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import rsj.context.ApplicationContextUtil;
import rsj.api.test.entity.AddTestDataParam;
import rsj.api.user.BaseLink;
import rsj.service.test.AddSupplierData;
import rsj.service.test.IAddDataTemplateMethod;
import common.util.validator.ParameterConversionCheck;

import java.sql.SQLException;

/**
 * 供应商数据录入
 *
 * @author yuanqinglong
 * @since 2021/3/15 13:33
 */
@Deprecated
@RestController
public class AddSupplierDataController extends BaseLink {


    /**
     * 供应商数据录入
     *
     * @param box 参数
     * @return 结果
     * @throws SQLException 异常
     */
    @Override
    @RequestMapping(value = "rsj_add_supplier_data")
    public Box executeLink(Box box) throws SQLException {
        AddTestDataParam addTestDataParam = (AddTestDataParam) ParameterConversionCheck.parameterConversionCheckFastFail(box, AddTestDataParam.class);
        IAddDataTemplateMethod addData = ApplicationContextUtil.getApplicationContext().getBean(AddSupplierData.class);
        addData.executeAddingData(addTestDataParam);
        return super.executeLink(box);
    }
}
